package intermediate_representation;

import symbal.Vtype;

public class ParaRP extends InterRP {
    private Vtype type;
    private String name;
    private int dem;
    private int len2;

    public ParaRP(String name, int dem) {
        if (dem == 0) {
            this.type = Vtype.INT;
        } else {
            this.type = Vtype.INT1;
        }
        this.name = name;
    }

    public ParaRP(String name, int dem, int len2) {
        if (dem == 2) {
            this.type = Vtype.INT2;
            this.len2 = len2;
        }
        this.name = name;
    }

    public Vtype getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public int getLen2() {
        return len2;
    }

    public String toString() {
        String str = "para ";
        if (type.equals(Vtype.INT)) {
            str += "int " + name;
        } else if (type.equals(Vtype.INT1)) {
            str += "int " + name + "[]";
        } else {
            str += "int " + name + "[][" + len2 + "]";
        }
        return str;
    }
}
